<template>
  <div class="app-container">
    <el-descriptions :column="2" title="企业信息">
      <el-descriptions-item :span="3" label="营业执照">
        <ImageUpload :disabled="true" :limit="1" :isShowTip="false" v-model="form.businessLicensePath"></ImageUpload>
      </el-descriptions-item>
      <el-descriptions-item :span="2" label="签约状态">
        <el-tag v-if="form.authenticationStatus === 1">已签约</el-tag>
        <el-tag v-else-if="form.authenticationStatus === 0" type="warning">未签约</el-tag>
      </el-descriptions-item>

      <el-descriptions-item :span="2"  label="企业名称">
        {{form.companyName}}
      </el-descriptions-item>

      <el-descriptions-item label="统一社会信用代码">
        {{form.creditCode}}
      </el-descriptions-item>
      <el-descriptions-item label="营业执照有效期">
        {{form.licenseValidFrom}} - {{form.licenseValidTo}}
      </el-descriptions-item>

      <el-descriptions-item :span="2" label="经营地址">
        {{form.operateAddress}}
      </el-descriptions-item>
      <el-descriptions-item :span="2" label="业务简介">
        {{form.companyProfile}}
      </el-descriptions-item>
      <el-descriptions-item :span="2" label="公司内部照">
        <ImageUpload :limit="5" :disabled="true" :isShowTip="false" v-model="form.storefrontPhotoPath"></ImageUpload>
      </el-descriptions-item>
    </el-descriptions>

    <el-descriptions :column="2" title="法人信息">
      <el-descriptions-item label="法人姓名">
        {{form.legalRepresentativeName}}
      </el-descriptions-item>
      <el-descriptions-item label="法人手机">
        {{form.legalRepresentativePhone}}
      </el-descriptions-item>
    </el-descriptions>

    <el-descriptions :column="2" title="管理员">
      <el-descriptions-item label="管理员姓名">
        {{form.administratorName}}
      </el-descriptions-item>
      <el-descriptions-item label="管理员手机号">
        {{form.administratorPhone}}
      </el-descriptions-item>
    </el-descriptions>

    <el-descriptions :column="2" title="申请人">
      <el-descriptions-item label="申请人昵称">
        {{agentData.createBy}}
      </el-descriptions-item>
    </el-descriptions>
  </div>
</template>
<script>
import {getAgent} from "@/api/system/agent";

export default {
  name: "agentDetail",
  props:{
    agentData:{
      type:Object,
    },
  },
  data() {
    return{
      loading:false,
      form:{

      },
      organizationId:null,
    }
  },
  methods:{
    getDetail(){
      this.loading = true
      getAgent(this.organizationId).then(res=>{
        this.loading = false
        this.form = res.data
      }).catch(()=>{
        this.loading = false
      })
    },
  },
  watch:{
    agentData:{
      handler(val){
        if (val){
          this.organizationId = val.initiateOrganizationId
          this.getDetail()
        }
      },
      immediate:true
    }
  }
}
</script>
<style scoped lang="scss">
::v-deep .el-descriptions{
  margin-top: 20px;
  .el-descriptions__header{
    margin-bottom: 10px;
  }
}
</style>
